home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-05-14 | 1.1 KB | 54 lines | [TEXT/CWIE] |
- //
- // StQD3DInitializer.h
- //
- // A stack-based class to initialize and clean up a QuickDraw 3D environment.
- // Declare it in main() after your toolbox initialization.
- //
- // by James Jennings
- // November 12, 1995
- //
- // Note: The names of the gestalt codes are different
- // from what's in the documentation.
- //
-
- #pragma once
-
- #include "StQD3DInitializer.h"
-
-
- Boolean StQD3DInitializer::HasQD3D(void)
- {
- #if 1 // there are two ways to test this
- long result;
- OSErr err = ::Gestalt(gestaltQD3D, &result);
- return (err == noErr) && (result == gestaltQD3DAvailable);
- #else
- return ((Boolean) Q3Initialize != kUnresolvedSymbolAddress);
- #endif
- }
-
-
- StQD3DInitializer::StQD3DInitializer(void)
- : status(kQ3Failure)
- {
- if (!HasQD3D()) return; // Throw exception?
- status = ::Q3Initialize();
- if (status == kQ3Failure)
- SignalPStr_("\pQuickDraw 3D is not available.");
- }
-
-
- StQD3DInitializer::~StQD3DInitializer(void)
- {
- if (status==kQ3Success)
- status = ::Q3Exit();
- // if (status == kQ3Failure) // Throw exception?
- }
-
-
- TQ3Status StQD3DInitializer::GetStatus(void)
- {
- return status;
- }
-
-